<%@ include file="../layout/taglib.jsp"%>
<div class="content-middle" id="content-middle">


	<div class="layer2">
		<div class="wrap1">
			<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
				<div class="boxImage">
					<img
						src="<%=request.getContextPath()%>/resources/images/front/our-featured-courses.jpg"
						alt="" />
				</div>
			</div>
			<jsp:useBean id="now" class="java.util.Date" />
			<fmt:formatDate var="year" value="${now}" pattern="yyyy" />
			<c:forEach items="${courses}" var="course" varStatus="status">
				<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
					<figure class="boxImage cell1" id="${course.idCourse}">
						<img
							src="<%=request.getContextPath()%>/photoCorfront/${course.idCourse};"
							alt="Courses image">
						<figcaption>
							<div id="image_user">
								<img alt="${course.teacher.firstName}"
									src="<%=request.getContextPath()%>/photoUser?idUser=${course.teacher.idUser}">
							</div>

							<div id="text_title">
								<p>${course.titleProd}</p>
							</div>
							<div id="text_name">
								<p>By ${course.teacher.firstName}</p>
							</div>
							<hr class="break_line">
							<div id="text_view">
								<img alt="view"
									src="<%=request.getContextPath()%>/resources/images/front/View.png">
								<c:if test="${empty course.nbview}">0</c:if>
								<c:if test="${not empty course.nbview}">${course.nbview}</c:if>

							</div>
							<c:if test="${not empty course.dateCreation}">

								<fmt:formatDate var="creation_year1"
									value="${course.dateCreation}" pattern="yyyy" />
								<div id="text_view">
									<img alt="Calendar"
										src="<%=request.getContextPath()%>/resources/images/front/Calendar.png"
										width="10px"> Created ${year-creation_year1} years ago
								</div>
							</c:if>
						</figcaption>
					</figure>
				</div>
			</c:forEach>
			<div class="clearfix"></div>
		</div>
	</div>
</div>

